home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / lynx-2.4 / WWW / Library / Implementation / HTFile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-28  |  4.5 KB  |  203 lines

  1. /*                                                                      File access in libwww
  2.                                        FILE ACCESS
  3.                                              
  4.    These are routines for local file access used by WWW browsers and servers. Implemented
  5.    by HTFile.c.
  6.    
  7.    If the file is not a local file, then we pass it on to HTFTP in case it can be reached
  8.    by FTP.
  9.    
  10.  */
  11. #ifndef HTFILE_H
  12. #define HTFILE_H
  13.  
  14. #include "HTFormat.h"
  15. #include "HTAccess.h"
  16. #include "HTML.h"               /* SCW */
  17.  
  18.  
  19.  
  20. /*
  21.  
  22. Controlling globals
  23.  
  24.    These flags control how directories and files are represented as hypertext, and are
  25.    typically set by the application from command line options, etc.
  26.    
  27.  */
  28. extern int HTDirAccess;         /* Directory access level */
  29.  
  30. #define HT_DIR_FORBID           0       /* Altogether forbidden */
  31. #define HT_DIR_SELECTIVE        1       /* If HT_DIR_ENABLE_FILE exists */
  32. #define HT_DIR_OK               2       /* Any accesible directory */
  33.  
  34. #define HT_DIR_ENABLE_FILE      ".www_browsable" /* If exists, can browse */
  35.  
  36. extern int HTDirReadme;         /* Include readme files in listing? */
  37.                                         /* Values: */
  38. #define HT_DIR_README_NONE      0       /* No */
  39. #define HT_DIR_README_TOP       1       /* Yes, first */
  40. #define HT_DIR_README_BOTTOM    2       /* Yes, at the end */
  41.  
  42. #define HT_DIR_README_FILE              "README"
  43.  
  44.  
  45. /*
  46.  
  47. Convert filenames between local and WWW formats
  48.  
  49.  */
  50. extern char * HTLocalName PARAMS((CONST char * name));
  51.  
  52.  
  53. /*
  54.  
  55. Make a WWW name from a full local path name
  56.  
  57.  */
  58. extern char * WWW_nameOfFile PARAMS((const char * name));
  59.  
  60.  
  61. /*
  62.  
  63. Generate the name of a cache file
  64.  
  65.  */
  66. extern char * HTCacheFileName PARAMS((CONST char * name));
  67.  
  68.  
  69. /*
  70.  
  71. Output directory titles
  72.  
  73.    This is (like the next one) used by HTFTP. It is common code to generate the title and
  74.    heading 1 and the parent directory link for any anchor.
  75.    
  76.  */
  77. extern void HTDirTitles PARAMS((
  78.         HTStructured *  target,
  79.         HTAnchor *      anchor));
  80.  
  81. /*
  82.  
  83. Output a directory entry
  84.  
  85.    This is used by HTFTP.c for example -- it is a common routine for generating a linked
  86.    directory entry.
  87.    
  88.  */
  89. extern void HTDirEntry PARAMS((
  90.         HTStructured *  target,         /* in which to put the linked text */
  91.         CONST char *    tail,           /* last part of directory name */
  92.         CONST char *    entry));        /* name of this entry */
  93.  
  94. /*
  95.  
  96. HTSetSuffix: Define the representation for a file suffix
  97.  
  98.    This defines a mapping between local file suffixes and file content types and
  99.    encodings.
  100.    
  101.   ON ENTRY,
  102.   
  103.   suffix                  includes the "." if that is important (normally, yes!)
  104.                          
  105.   representation          is MIME-style content-type
  106.                          
  107.   encoding                is MIME-style content-transfer-encoding (8bit, 7bit, etc)
  108.                          
  109.   quality                 an a priori judgement of the quality of such files (0.0..1.0)
  110.                          
  111.  */
  112. /* Example:   HTSetSuffix(".ps", "application/postscript", "8bit", 1.0);
  113. **
  114. */
  115.  
  116. extern void HTSetSuffix PARAMS((
  117.         CONST char *    suffix,
  118.         CONST char *    representation,
  119.         CONST char *    encoding,
  120.         float           quality));
  121.         
  122.  
  123. /*
  124.  
  125. HTFileFormat: Get Representation and Encoding from file name
  126.  
  127.   ON EXIT,
  128.   
  129.   return                  The represntation it imagines the file is in
  130.                          
  131.   *pEncoding              The encoding (binary, 7bit, etc). See HTSetSuffix .
  132.                          
  133.  */
  134. extern HTFormat HTFileFormat PARAMS((
  135.                 CONST char *    filename,
  136.                 HTAtom **       pEncoding));
  137.  
  138.  
  139. /*
  140.  
  141. Determine file value from file name
  142.  
  143.  */
  144.  
  145.  
  146. extern float HTFileValue PARAMS((
  147.                 CONST char * filename));
  148.  
  149.  
  150. /*
  151.  
  152. Determine write access to a file
  153.  
  154.   ON EXIT,
  155.   
  156.   return value            YES if file can be accessed and can be written to.
  157.                          
  158.  */
  159.  
  160. /*
  161.  
  162.   BUGS
  163.   
  164.    Isn't there a quicker way?
  165.    
  166.  */
  167.  
  168.  
  169. extern BOOL HTEditable PARAMS((CONST char * filename));
  170.  
  171.  
  172. /*
  173.  
  174. Determine a suitable suffix, given the representation
  175.  
  176.   ON ENTRY,
  177.   
  178.   rep                     is the atomized MIME style representation
  179.                          
  180.   ON EXIT,
  181.   
  182.   returns                 a pointer to a suitable suffix string if one has been found,
  183.                          else NULL.
  184.                          
  185.  */
  186. extern CONST char * HTFileSuffix PARAMS((
  187.                 HTAtom* rep));
  188.  
  189.  
  190.  
  191. /*
  192.  
  193. The Protocols
  194.  
  195.  */
  196. GLOBALREF HTProtocol HTFTP, HTFile;
  197.  
  198. #endif /* HTFILE_H */
  199.  
  200. /*
  201.  
  202.    end of HTFile */
  203.